<style scoped lang="less">
@import "styles/common.css";
</style>
<template>
  <div>
    <!-- <h1>{{name}}</h1>
    <button @click="changeName">changeName</button>-->
    <router-view></router-view>
  </div>
</template>
<script>
// import {getOperator} from './api/user';
import { mapActions, mapState, mapGetters } from "vuex";
export default {
  provide() {
    return {
      globalData: this.globalData,
      reload: this.reload,
    };
  },
  computed: {
    ...mapState({
      name: (state) => state.user.name,
    }),
  },
  data() {
    return {
      globalData: {
        isAdmin: "",
        userInfo: {},
        roleList: [],
        tagList: [{ name: "首页", path: "/info" }],
        operatorList: [],
        operatorListAll: [{ value: "all", label: "所有运营商" }],
      },
    };
  },
  methods: {
    changeName() {
      // this.$store.dispatch("user/changeName", "json")
      this.sendMessage("game1");
    },
    reload() {
      let Menus = JSON.parse(sessionStorage.getItem("Menus"));
      // console.log(Menus);
      if (!Menus) {
        return this.$Modal.error({
          title: "通知",
          content: "身份已过期,请重新登录",
          onOk: () => {
            this.$router.push("/");
          },
        });
      }
      this.globalData.Menus = Menus;
    },
    getOperator() {
      this.globalData.operatorList = [];
      this.globalData.operatorListAll = [{ value: "all", label: "所有运营商" }];
      getOperator().then((data) => {
        if (data.code == 200) {
          data.data.forEach((item) => {
            let obj = {
              value: item._id + "",
              label: item.trueName,
            };
            this.globalData.operatorList.push(obj);
            this.globalData.operatorListAll.push(obj);
          });
        }
      });
    },
  },
  created() {},
};
</script>
